package cn.echoedu.control;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.echoedu.command.base.FailureParam;
import cn.echoedu.command.base.SuccessParam;
import cn.echoedu.entity.Professional;
import cn.echoedu.entity.receivecommand.ProfessionalListReceive;

public class ProfessionalControl extends BaseControl{
	
	public void queryProfessionalListByDepartmentCode(HttpServletRequest request,
			HttpServletResponse response,ProfessionalListReceive professionallistreceive) {
		// TODO Auto-generated method stub
		List<Professional> professionallist = getProfessionalModel().queryProfessionalListByDepartmentCode(
				professionallistreceive.getDepartmentcode());
		sendSuccess(request,response,professionallist,professionallistreceive.getToken()
				,professionallistreceive.getCode());
	}
	private void sendSuccess(HttpServletRequest request,HttpServletResponse response
			,Object param,String token,int code){
		SuccessParam successparam = new SuccessParam();
		successparam.setParam(param);
		successparam.setRequest(request);
		successparam.setResponse(response);
		successparam.setToken(token);
		successparam.setCode(code);
		getResponseService().doProfessionalListSuccess(successparam);
	}
	private void sendFailure(HttpServletRequest request,
			HttpServletResponse response,Object param){
		FailureParam failureparam = new FailureParam();
		failureparam.setParam(param);
		failureparam.setRequest(request);
		failureparam.setResponse(response);
		getResponseService().doTeacherAddNotifyFailure(failureparam);
	}

}
